x
} private _startSync() { this.state(TestCase.State.Running); this.runtime(0); this._started = dateNow(); var failure: Error; var failed = false; try { this._test.apply(this._this_); } catch (error) { failed = true; failure = error; } this.runtime(dateNow() - this._started); if (failed) { this.failure(failure); this.state(TestCase.State.Failed); } else { this.state(TestCase.State.Succeeded); } } private _startAsync(callback?: () => void) { this.state(TestCase.State.Running); this.runtime(0); this._started = dateNow(); var failure: Error; var failedSynchrously = false; try { this._test.apply(this._this_, [(failure?) => { this.runtime(dateNow() - this._started); if (failure) { this.failure(failure); this.state(TestCase.State.Failed); } else { this.state(TestCase.State.Succeeded); } if (callback) callback(); }]); } catch (error) { failedSynchrously = true; failure = error; } this.runtime(dateNow() - this._started); if (failedSynchrously) { this.failure(failure); this.state(TestCase.State.Failed); if (callback) callback(); } } }